package com.hqbzl.chat.constant;

import com.google.common.collect.ImmutableListMultimap;
import com.hqbzl.chat.model.*;

import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

public class Constants {

    public static ImmutableListMultimap<Integer, Class> MESSAGEID_TO_CLSS = ImmutableListMultimap.<Integer, Class>builder().build();
    public static ConcurrentMap<Integer, Class> MESSAGE_TYPE_MAP = new ConcurrentHashMap<>();

    public static final int LOGIN_MSG_TYPE = 0;
    public static final int GROUP_CREATE_MSG_TYPE = 1;
    public static final int GROUP_EXIT_MSG_TYPE = 2;
    public static final int GROUP_JOIN_MSG_TYPE = 3;
    public static final int GROUP_MEMBER_MSG_TYPE = 4;
    public static final int GROUP_GROUP_MSG_TYPE = 5;
    public static final int GROUP_SEND_MSG_TYPE = 6;
    public static final int LOGIN_RESPONSE_MSG_TYPE = 7;
    public static final int PING_REQUEST_MSG_TYPE = 8;
    public static final int PING_RESPONSE_MSG_TYPE = 9;
    public static final int RESPONSE_MSG_TYPE = 10;
    public static final int SEND_MSG_TYPE = 11;

    static {
        MESSAGE_TYPE_MAP.put(LOGIN_MSG_TYPE, LoginRequestMessage.class);
        MESSAGE_TYPE_MAP.put(GROUP_CREATE_MSG_TYPE, GCreageMessage.class);
        MESSAGE_TYPE_MAP.put(GROUP_EXIT_MSG_TYPE, GExitGroupMessage.class);
        MESSAGE_TYPE_MAP.put(GROUP_JOIN_MSG_TYPE, GJoinGroupMessage.class);
        MESSAGE_TYPE_MAP.put(GROUP_MEMBER_MSG_TYPE, GMemgersMessage.class);
        MESSAGE_TYPE_MAP.put(GROUP_GROUP_MSG_TYPE, Group.class);
        MESSAGE_TYPE_MAP.put(GROUP_SEND_MSG_TYPE, GSendMessage.class);
        MESSAGE_TYPE_MAP.put(LOGIN_RESPONSE_MSG_TYPE, LoginResponseMessage.class);
        MESSAGE_TYPE_MAP.put(PING_REQUEST_MSG_TYPE, PingRequestMessage.class);
        MESSAGE_TYPE_MAP.put(PING_RESPONSE_MSG_TYPE, PingResponseMessage.class);
        MESSAGE_TYPE_MAP.put(RESPONSE_MSG_TYPE, ResponseMessage.class);
        MESSAGE_TYPE_MAP.put(SEND_MSG_TYPE, SendMessage.class);
    }


}
